<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" isELIgnored="false" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<%@ include file="/include/header.jsp"%>
<title><s:i18n name="menus"><s:text name="alertsSetting"></s:text></s:i18n></title>

<link href="<%=request.getContextPath()%>/fare/css/base.css" rel="stylesheet" type="text/css" />

<script src="<%=request.getContextPath()%>/fare/lib/jquery/jquery.form.js" type="text/javascript"></script>	
<script src="<%=request.getContextPath() %>/fare/js/datePicker/WdatePicker.js" type="text/javascript" ></script>

<script src="<%=request.getContextPath() %>/jsFile/common.js" type="text/javascript"></script>


<script src="<%=request.getContextPath() %>/fare/js/datePicker/WdatePicker.js" type="text/javascript"></script>

<link href="<%=request.getContextPath() %>/fare/css/form_style.css" rev="stylesheet" media="all"  type="text/css" rel="stylesheet">

<!-- 圆角文本框 -->
<link href="<%=request.getContextPath() %>/fare/css/htc/htc.css" rel="stylesheet" type="text/css" />


<script type="text/javascript">
$(function(){
	var hflightFrom = $("#hflightFrom").val();
	var hflightTo = $("#hflightTo").val();
	var heffectiveFrom = $("#heffectiveFrom").val();
	var heffectiveTo = $("#heffectiveTo").val();
	//获取隐藏域回填
	var futureDays=$("input[name='futureDays'][type='hidden']").val();
	var triggerCondition=$("input[name='triggerCondition'][type='hidden']").val();
	
	
	
	if(futureDays!=""&& futureDays!="0"){
		$("#futureDays").val(futureDays);
	}
	if(triggerCondition!="" && triggerCondition!="0"){
		$("#triggerCondition").val(triggerCondition);
	}
	
	if(hflightFrom!=""){
		$("#flightFrom").val(hflightFrom);
	}
	
	if(hflightTo!=""){
		$("#flightTo").val(hflightTo);
	}
	
	 if(heffectiveFrom!=""){
		$("#effectiveFrom").val(heffectiveFrom);
	}
	
	if(heffectiveTo!=""){
		$("#effectiveTo").val(heffectiveTo);
	}
	/* 
	$('#flightFrom').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList});
	$('#flightTo').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList});
	
	$('#_flightFrom').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList});
	$('#_flightTo').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList});
	
	$('#flightFrom0').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList});
	$('#flightTo0').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList}); */
	
	
	if(${fn:length(listvo)}==0 && $("#queryJump").val()==0){//0表示是通过查询回到这个页面
		//alert("对不起，暂时没有预警结果数据");
		var html = 
			"<td class='line'>${idx.count}</td>"+				
		   	"<td class='line' id='alertType${idx.count}'></td>"+
	   		"<td class='line' id='alertDescription${idx.count}'></td>"+
		    "<td class='line'></td>"+
	 	    "<td class='line'></td>"
		$("#form_list_table").append(html);
	}
	
	
	
	
	$("#flightFrom").css({
		"color":"black"
	});
	$("#flightTo").css({
		"color":"black"
	});
	
	var alertType = '${alertType}';
	var createTimeStr = '${createTimeStr}';
	var endCreateTimeStr = '${endCreateTimeStr}';
	if(alertType != 'all'){
		$("#alertType").find("option[value='"+alertType+"']").attr("selected",true);
	}
	if(createTimeStr != ''){
		 $("#createTime").val(createTimeStr);
	}
	
	if(endCreateTimeStr != ''){
		 $("#endCreateTime").val(endCreateTimeStr);
	}
	
	
	
	//alert(alertType +" - "+createTime);
});
function formateDate(createTime){ 
    var now = new Date();       
    var year = now.getFullYear();
    var month = now.getMonth() + 1;
    var day = now.getDate();
   
    var today = year + "-";       
    if(month < 10)
        today += "0";       
    today += month + "-";       
    if(day < 10)
        today += "0";           
    today += day;       
    return(today); 
} 
<%-- //修改操作
function show(id,alertType){
	if(alertType=="最低价预警"){
		alertType = "0";
	}else if(alertType=="舱位变动预警"){
		alertType = "1";
	}else if(alertType=="价差预警"){
		alertType = "2";
	}else if(alertType=="竞争对比预警"){
		alertType = "3";
	}
	
	var url="<%=request.getContextPath() %>/freightPriceAnalyseAlertConfigAction!getFreightPriceAnalyseAlertConfigById.action?id="
			+id+
			"&alertType="+alertType;
	var w_w=800; //弹出窗口的宽度;
	var w_h=600; //弹出窗口的高度;
	var iTop = (window.screen.availHeight-30-w_h)/2; //获得窗口的垂直位置;
	var iLeft = (window.screen.availWidth-10-w_w)/2; //获得窗口的水平位置;
	var obj={//带过去下个页面的参数数据
			//	CHENKED_FLIGHTS:CHENKED_FLIGHTS,
				pWin:window//把父窗口放过去
		}; 
	
	var result = window.showModalDialog(url,obj,
	'dialogHeight=600px;dialogWidth=800px;dialogTop='+iTop+'px;dialogLeft='+iLeft+'px;status=no;scroll=no;resizable=no;help=no');
	if(result && result == 'ok'){
		/* var url = window.location.href;
		if(url.indexOf("?") > -1) url += "&"+Math.random();
		else url += "?"+Math.random();
		window.location.href = url; */
	}
} --%>
//刷新当前页面一次
function reurl(){
	/*  url = location.href; 
	 var times = url.split("?"); 
	 if(times[1] != 1){ 
	 url += "?1"; 
	 self.location.replace(url);
	 } */
	 window.location.reload();
}
function showhaha(){
	alert("haha");
}

function showDataAgain(){
	 reurl();
}
//增加操作
 function add(){
	 var url="<%=request.getContextPath() %>/freightPriceAnalyseAlertConfigAction!whenAddinitSelect.action";
	var w_w=800; //弹出窗口的宽度;
	var w_h=600; //弹出窗口的高度;
	var iTop = (window.screen.availHeight-30-w_h)/2; //获得窗口的垂直位置;
	var iLeft = (window.screen.availWidth-10-w_w)/2; //获得窗口的水平位置;
	var obj={//带过去下个页面的参数数据
			//	CHENKED_FLIGHTS:CHENKED_FLIGHTS,
				pWin:window//把父窗口放过去
		};
	var result = window.showModalDialog(url,obj,
	'dialogHeight=600px;dialogWidth=800px;dialogTop='+iTop+'px;dialogLeft='+iLeft+'px;status=no;scroll=no;resizable=no;help=no');
	
	if(result && result == 'ok'){
		var url = window.location.href;
		if(url.indexOf("?") > -1) url += "&"+Math.random();
		else url += "?"+Math.random();
		window.location.href = window.location.href;
	} 
	<%--  var url="<%=request.getContextPath() %>/freightPriceAnalyseAlertConfigAction!showSpread.action";
	var w_w=800; //弹出窗口的宽度;
	var w_h=600; //弹出窗口的高度;
	var obj={//带过去下个页面的参数数据
			//	CHENKED_FLIGHTS:CHENKED_FLIGHTS,
				pWin:window//把父窗口放过去
		};
	var iTop = (window.screen.availHeight-30-w_h)/2; //获得窗口的垂直位置;
	var iLeft = (window.screen.availWidth-10-w_w)/2; //获得窗口的水平位置;
	var result = window.showModalDialog(url,obj,
	'dialogHeight=600px;dialogWidth=800px;dialogTop='+iTop+'px;dialogLeft='+iLeft+'px;status=no;scroll=no;resizable=no;help=no');
	
	if(result && result == 'ok'){
		var url = window.location.href;
		if(url.indexOf("?") > -1) url += "&"+Math.random();
		else url += "?"+Math.random();
		window.location.href = window.location.href;
	}  --%>
 }  

 function homePage(){
	 document.location.href='<%=request.getContextPath() %>/freightPriceAnalyseAlertConfigAction!getAllFreightPriceAnalyseAlertConfig.action?count='+$('#count').val();
 }
 function previousPage(){
	 document.location.href='<%=request.getContextPath() %>/freightPriceAnalyseAlertConfigAction!getAllFreightPriceAnalyseAlertConfig.action?count='+$('#count').val();
 }
 
 function presentPage(){
	 if(event.keyCode == 13){
		 document.location.href='<%=request.getContextPath() %>/freightPriceAnalyseAlertConfigAction!getAllFreightPriceAnalyseAlertConfig.action?count='+$('#count').val();
	 }
 }
 function nextPage(){
	 document.location.href='<%=request.getContextPath() %>/freightPriceAnalyseAlertConfigAction!getAllFreightPriceAnalyseAlertConfig.action?count='+$('#count').val();
 }



function changeAction(url){
	$('#form1').attr('action',url);
	$('#form1').submit();
}

/* function allDeleteTaskInfo(){
	 
	 if(confirm('确定要删除吗？')){
		 $("#showTaskInfoListForm").attr("action","taskInfoAction!deleteTaskInfoEntity.action").submit();
	 }
} */

function queryByc(){
	/* //航段比较
	var flightFrom = $("#flightFrom").val();
	var flightTo = $("#flightTo").val();
	
	
	if(flightFrom!="中文/拼音"&&flightTo!="中文/拼音"&&$.trim(flightFrom)!=""&&$.trim(flightTo)!=""){
		if(flightFrom==flightTo){
			alert("出发地与目的地不能相同");
			return false;
		}
	} */
     
	
	/* //预警有效期比较
	var effectiveFrom = $("#effectiveFrom").val();
	var effectiveTo   = $("#effectiveTo").val();
	
	var s_date = new Date(effectiveFrom.replace(/-/g,"/"));
    var e_date = new Date(effectiveTo.replace(/-/g,"/"));
    
    var time1 = s_date.getTime();
	var time2 = e_date.getTime();
	if(time1>time2){
		alert("结束时间不能小于开始时间");
		return;
	} */
	
	/* //触发条件比较  	//未来天数为正整数
    var futureDays = $("#futureDays").val();
    var triggerCondition = $("#triggerCondition").val();
    
    if(futureDays!=null&&$.trim(futureDays)!=''){
    	if(!(/(^[1-9]\d*$)/.test(futureDays))){
        	alert("天数不为正整数");
        	$("#futureDays").val('');
        	return false;
        }
        
        if(parseInt(futureDays)>30||parseInt(futureDays)<1){
        	alert("未来天数范围1~30");
        	return false;
        }
    } */
    
    
  /*   //触发 条件 天数为正整数
    if(triggerCondition!=null&&$.trim(triggerCondition)!=''){
    	if(!(/(^[1-9]\d*$)/.test(triggerCondition))){
        	alert("天数不为正整数");
        	$("#triggerCondition").val('');
        	return false;
        }
    } */
	//只打空格时回填“”
/* 	if($.trim(triggerCondition)==""){$("#triggerCondition").val("");}
    
    if(futureDays!=null&&triggerCondition!=null&&$.trim(futureDays)!=''&&$.trim(triggerCondition)!=''){
    	var conditionTime=parseInt(triggerCondition);//触发时间
    	var futureTime=parseInt(futureDays);
    	if((futureTime+1)<conditionTime&&conditionTime>1){
    		alert("触发条件可填的最大值为未来天数+1，最小数为1");
    		return false;
    	};
    } */
	//只打空格时回填“”
	/* if($.trim(futureDays)==""){$("#futureDays").val("");} */
	
	
	//变为查询标志，下一次跳转可以看到是通过查询跳转过来的
	$("#queryJump").val(0);
	
	 $('#form1').attr('action','freightPriceAnalyseAlertConfigAction!getAllFreightPriceAnalyseAlertConfigByC.action');
	 $('#form1').submit();
	
	/* $.post('freightPriceAnalyseAlertConfigAction!getAllFreightPriceAnalyseAlertConfigByC.action',
			$("#form1").serialize(),
			function(message){
				if(message=="fail")
				  alert("对不起，没有相关数据！");
				else{
					//window.location.reload();
				}
		},'text');  */
}


</script>
</head>

<body>
<%@ include file="/include/home/home_header.jsp" %>
<jsp:include page="/pages/system/feedback/feedback.jsp" ></jsp:include>
<div class="main main_max minhgt450">
	<div class="sideBar">
	<div class="box">
		<div class="location"><s:i18n name="forms"><s:text name="forms.position"></s:text></s:i18n>： <s:text name="share.personC"/> &gt;  
		<s:i18n name="menus"><s:text name="alertsSetting"></s:text></s:i18n></div>
	</div>
	</div>
<div class="form_table_tltle"><s:i18n name="forms"><s:text name="forms.query"></s:text></s:i18n> </div>
<form id="form1" method="post">
	<input type="hidden" id="hflightFrom" name="hflightFrom" value="${flightFrom}"/>
	<input type="hidden" id="hflightTo" name="hflightTo" value="${flightTo}"/>
	<input type="hidden" id="heffectiveFrom" name="heffectiveFrom" value="${efd}"/>
	<input type="hidden" id="heffectiveTo" name="heffectiveTo" value="${etd}"/>
	<input type="hidden" id="hbookingType" name="hbookingType" value="${bookingType}"/>
	<%-- 查询跳转 --%> 
	<input type="hidden" id="queryJump" name="queryJump" value='${queryJump}'/>
<table cellSpacing=0 cellPadding=0 width="100%" border=0 class="form_table"> 

	<TR>
	  	<TD width="120" height="26" class="left" style="text-align:left">
	  		<s:i18n name="forms"><s:text name="forms.alertType"></s:text></s:i18n>:
	  			
	  		<%-- <select>
	  				<option value="none"></option>
	  				<option value="">最低价预警</option>
	  				<option value="">舱位变动预警</option>
	  				<option value="">价差预警</option>
	  				<option value="">竞争对比预警</option>
	  			</select> --%>
	    </TD>
	    <TD colspan="1">
	    	<select class="easyui-combobox" name="alertType" id="alertType">
				    <option value="all" selected="selected">---<s:i18n name="forms"><s:text name="forms.select"></s:text></s:i18n>---</option>
	  				<option value="0"><s:i18n name="forms"><s:text name="forms.lowestAlert"></s:text></s:i18n></option>
	  				<option value="1"><s:i18n name="forms"><s:text name="forms.cabinAlert"></s:text></s:i18n></option>
	  				<option value="2"><s:i18n name="forms"><s:text name="forms.spreadAlert"></s:text></s:i18n></option>
	  				<option value="3"><s:i18n name="forms"><s:text name="forms.competitionAlert"></s:text></s:i18n></option>
		    </select>    
	    </TD>
	    <TD colspan="1">				
            <s:i18n name="forms"><s:text name="forms.creatTime"></s:text></s:i18n>:
		</TD>
		 <TD colspan="1">				
               <input name="createTime" type="text" id="createTime" style="width:100px"   
	  	     onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd',lang:'<s:i18n name='forms'><s:text name='forms.locale'></s:text></s:i18n>'});" readonly="readonly">~
	  	     <input name="endCreateTime" type="text" id="endCreateTime" style="width:100px"   
	  	     onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd',lang:'<s:i18n name='forms'><s:text name='forms.locale'></s:text></s:i18n>'});" readonly="readonly">
		</TD>
  </TR>

<!-- 以下是没修改改前的代码 -->
<%--   <TR>
				<TD width="120" height="26" class="left" style="text-align:left">航空公司&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;：
			    </TD>
			    <TD >
			       <select name="airCompany" style="width: 130px;" id="airCompany">
							<c:choose>
								<c:when test="${tempList == null}">
								</c:when>
								<c:otherwise>
									<c:forEach var="item" items="${tempList}">
										<option>${item.name}</option>
									</c:forEach>
								</c:otherwise>
							</c:choose>
					</select>
					<span style="color: #ff0000">*</span>
			    </TD>
    
    <TD width="120" height="26" class="left" style="text-align:center">航&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;段：
    </TD>
    
    <TD colspan="3">
      <span>从</span>
      <input type="text" style="width:100px" name="flightFrom" id="flightFrom"  >
      <span>到</span>
      <input type="text" style="width:100px" name="flightTo" id="flightTo" >&nbsp;&nbsp;&nbsp;
    </TD>
    
  </TR>
  <TR>
  	<TD  width="120" height="26" class="left" style="text-align:left">预警方式&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;：
    </TD>
    <TD>
    <select name="alertWay" style="width: 130px;" id="alertWay" disabled="disabled">
							<option value="1" selected="selected">邮件</option>
							<option value="0">短信</option>
					</select>
					<span style="color: #ff0000">*</span>
    </TD>
    <TD width="120" height="26" class="left" style="text-align:center">预警有效期：</TD>
    <TD colspan="3">
      <span>从</span>
      <input type="text"   style="width:100px" id="effectiveFrom" name="effectiveFrom" value="" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="readonly">
      <span>到</span>
      <input type="text" style="width:100px" id="effectiveTo" name="effectiveTo" value="" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="readonly">
	</TD>
	
  </TR>
  
  <TR>
	  	<TD width="120" height="26" class="left" style="text-align:left">触发条件：
	    </TD>
	    <TD colspan="5">				
                                该航线在未来
    		<input type="text" style="width:100px" name="futureDays" id="futureDays" value="">
			天的价格有 
			<input type="text" style="width:100px" name="triggerCondition" id="triggerCondition" value="">
			天以
			<select class="easyui-combobox" name="chooseUpOrdown" id="up_down" disabled="disabled">
				<option value="0" selected="selected">下</option>
				<option value="1" >上</option>
			</select>
			是最低价
		</TD>
  </TR> --%>
  
    <tr>
	    <td colspan='5' style="text-align:center;height:35px;">
		    <!-- 查询 -->
		   	<input type="button" value="" class="<s:i18n name='forms'><s:text name='forms.btn01'></s:text></s:i18n>" onclick="queryByc()"/>
		   	<!-- 重置 -->
		   	<input type="reset" value="" class="<s:i18n name='forms'><s:text name='forms.btn03'></s:text></s:i18n>"/>
		   	<!-- 新增 -->
		    <input type="button"  value="" class="<s:i18n name='forms'><s:text name='forms.btn09'></s:text></s:i18n>" onclick="add()" />
	    </td>
    </tr>
  
</TABLE>


</form>


<div class="form_table_tltle"><s:i18n name="forms"><s:text name="forms.alertResults"></s:text></s:i18n></div>
	<input type="hidden" name="flightFrom" value="${ flightFrom}"/>
	<input type="hidden" name="flightTo" value="${ flightTo}"/>
	<input type="hidden" name="alertWay" value="${ alertWay}"/>
	<input type="hidden" name="effectiveFrom" value="${ effectiveFrom}"/>
	<input type="hidden" name="effectiveTo" value="${ effectiveTo}"/>
	<input type="hidden" name="airCompany" value="${ airCompany}"/>
	<input type="hidden" name="futureDays" value="${ futureDays}"/>
	<input type="hidden" name="triggerCondition" value="${ triggerCondition}"/>
	
	
	
<table cellSpacing=0 cellPadding=0 width="100%" border=0 class="form_list" id="form_list_table">
  <tr class="title">
    <td><s:i18n name="forms"><s:text name="forms.Number"></s:text></s:i18n></td>
    <td><s:i18n name="forms"><s:text name="forms.alertType"></s:text></s:i18n></td>
    <td><s:i18n name="forms"><s:text name="forms.alertDes"></s:text></s:i18n></td>
    <!-- <td>航空公司</td>
    <td>出发地</td>
    <td>目的地</td>
    <td>起始时间</td>
    <td>截止时间</td>
    <td>预警方式</td>
    <td>触发条件</td> -->
    <td><s:i18n name="forms"><s:text name="forms.creatTime"></s:text></s:i18n></td>
    <td><s:i18n name="forms"><s:text name="forms.operating"></s:text></s:i18n></td>
     
  </tr>
	
  <c:forEach items="${listvo}" var="list" varStatus="idx" begin="${begin }" end="${end }">
	<tr>
	<input type="hidden" id="id${idx.count}" value="${list.id}"/>
	<input type="hidden" id="fromCityName${idx.count}" value="${ list.fromCityName}"/>
	<input type="hidden" id="toCityName${idx.count}" value="${ list.toCityName}"/>
	<input type="hidden" id="creator${idx.count}" value="${ list.creator}" />
	<input type="hidden" id="creatorName${idx.count}" value="${ list.creatorName}"/>
	<input type="hidden" id="createTime${idx.count}" value="${ list.createTime}"/>
	<input type="hidden" id="futureDays${idx.count}" value="${ list.futureDays}"/>
	<input type="hidden" id="alertWay${idx.count}" value="${ list.alertWay}"/>
	
   	<td class="line">${idx.count}</td>					
   	<td class="line" id="alertType${idx.count}">${ list.alertType}</td>
   	<td class="line" id="alertDescription${idx.count}">${ list.alertDescription}</td>
   <%-- 	<td class="line" ><input type="hidden" id="airCompany${idx.count}" value="${list.airCompany}" />${list.airCompany}</td>
    <td class="line" id="fromCityName${idx.count}">${ list.fromCityName}</td>
    <td class="line" id="toCityName${idx.count}">${ list.toCityName}</td>
    <td class="line" id="startTime${idx.count}"><fmt:formatDate value="${list.startTime}" pattern="yyyy-MM-dd"/></td>
    <td class="line" id="endTime${idx.count}"><fmt:formatDate value="${list.endTime}" pattern="yyyy-MM-dd"/></td>
    <td class="line">${list.alertWayName}</td>
    <td class="line" id="triggerCondition${idx.count}">${list.triggerCondition}</td> --%>
    <td class="line"><fmt:formatDate value="${list.updateTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
    <td class="line"><%--<a  onclick="show('${list.id}','${list.alertType}');return false;" href="#">修改</a> --%>
    <a onclick="return confirm('<s:i18n name="forms"><s:text name="forms.deleteAlert"></s:text></s:i18n>')" href="<%=request.getContextPath() %>/freightPriceAnalyseAlertConfigAction!deleteFreightPriceAnalyseAlertConfigStats.action?id=${list.id}">
           <s:i18n name="forms"><s:text name="forms.delete"></s:text></s:i18n></a></td>
  </tr>
  </c:forEach>
  </table>
  <br>
  </div>
<br><br><br><br><br><br><br><br><br><br><br>



<%@ include file="/include/home/home_footer.jsp" %>
<script src="<%=request.getContextPath()%>/fare/js/cityquery/querycity.js" type="text/javascript" ></script>

</body>

</html> 